<!DOCTYPE html>
<html lang="zh">
<head>
        <meta charset="UTF-8">
        <title>change事件方法</title>
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
        <form>
            <label>用户名：</label><input type="text" >
            <label>密码：</label><input type="password" >
            <button type="submit">Submit</button>
        </form>
        <script>
        var data = {name: 'Mary', sex: 'female'};
        $('input[type="text"]').change(data, function(e) {
            alert('通过data传入的用户名是：' + e.data.name);
        });
        </script>
</body>
</html>
